<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateDyGoodsOrder extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('dy_goods_order',['id' => false, 'collation'=>'utf8mb4_general_ci','comment'=>'抖音商品订单']);

        $table->addColumn('id', 'biginteger', ['limit' => 20, 'identity' => true, 'signed' => false])
            ->setPrimaryKey('id')
            ->addColumn('order_id','string',['limit'=>32,'comment'=>'抖音订单号'])
            ->addColumn('product_id','string',['limit'=>32,'comment'=>'抖音产品id'])
            ->addColumn('product_name','string',['limit'=>150,'comment'=>'商品标题'])
            ->addColumn('product_img','string',['limit'=>255,'comment'=>'主图'])
           // ->addColumn('order_status','boolean',['limit'=>1,'comment'=>'订单状态 1已付款 2退货退款 3已结算'])
            ->addColumn('flow_point','string',['limit'=>32,'comment'=>'订单标志 PAY_SUCC SETTLE REFUND'])
            ->addColumn('author_name','string',['limit'=>60,'comment'=>'作者账号'])
            ->addColumn('pay_amount','biginteger',['limit'=>10,'comment'=>'支付金额','signed' => false])
            ->addColumn('pay_succ_time','string',['limit'=>40,'comment'=>'支付时间'])
            ->addColumn('service_rate','integer',['limit'=>10,'comment'=>'服务费率'])
            ->addColumn('estimated_service_fee','integer',['limit'=>10,'comment'=>'预估服务费收入(分)','signed' => false])
            ->addColumn('real_service_fee','integer',['limit'=>10,'comment'=>'实际服务费收入(分)','signed' => false])
            ->addColumn('settle_time','string',['limit'=>40,'comment'=>'结算时间'])
            ->addColumn('stage_one_pay_money','biginteger',['limit'=>10,'comment'=>'平台1支付金额','signed' => false])
            ->addColumn('stage_one_pay_time','string',['limit'=>40,'comment'=>'平台1支付时间'])
            ->addColumn('stage_order','boolean',['limit'=>10,'comment'=>'是否是平台订单 1 0'])
            ->addColumn('stage_two_pay_time','string',['limit'=>40,'comment'=>'平台2支付时间'])
            ->addColumn('create_time','datetime',['comment'=>'创建时间'])
            ->addColumn('update_time','datetime',['comment'=>'更新时间'])
            ->create();

    }
}
